package org.zhadoop.stream.cql.semanticanalyzer.parser.visitor;

import org.zhadoop.stream.cql.CQLUtils;
import org.zhadoop.stream.cql.semanticanalyzer.parser.CQLParser.ApplicationNameContext;
import org.zhadoop.stream.cql.semanticanalyzer.parser.CQLParser.IsForceContext;
import org.zhadoop.stream.cql.semanticanalyzer.parser.CQLParser.PathContext;
import org.zhadoop.stream.cql.semanticanalyzer.parser.context.SubmitApplicationContext;

public class SubmitApplicationVisitor extends AbsCQLParserBaseVisitor<SubmitApplicationContext>{

	private SubmitApplicationContext context = null;
	
	public SubmitApplicationVisitor() {
		context = new SubmitApplicationContext();
	}
	
	@Override
	protected SubmitApplicationContext defaultResult() {
		return context;
	}
	
	@Override
	public SubmitApplicationContext visitIsForce(IsForceContext ctx) {
		context.setForce(true);
		return context;
	}
	
	@Override
	public SubmitApplicationContext visitApplicationName(ApplicationNameContext ctx) {
		context.setApplicationName(ctx.getText());
		return context;
	}
	
	@Override
	public SubmitApplicationContext visitPath(PathContext ctx) {
		context.setPath(CQLUtils.cqlStringLiteralTrim(ctx.getText()));
		return context;
	}
}
